/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ueb16;

/**
 *
 * @author steffenschuhmann
 */
public class BTreeImp implements BTree {
    
    private static final int ORDER = 4; 
    
    private BTreeNode root;
    
    public BTreeImp() throws BTreeException{
        root = new BTreeNodeImp(ORDER);
    }
    
    @Override
    public void insert(Object data) {
        
    }
    
    @Override
    public int find(Object object) {
        BTreeNode curNode = root;
        int childNumber;
        while (true) {
            if ((childNumber = curNode.findItem(key)) != -1) {
                return childNumber;
            } else if (curNode.isLeaf()) {
                return -1;
            } else {
                curNode = getNextChild(curNode, key);
            }
        } // end while
    }

    @Override
    public void split(BTreeNode node) {
     if(!node.isFull())
         throw new NullPointerException(); // TODO new Exception
     
     
    }

    @Override
    public BTreeNode getNextChild(BTreeNode node, int value) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    
}
